# Updated by Wei on 2013/09/25 morning at school
# key: current currentPostingKey = currentTerm + "_" + currentDocID in python string format
# value: freq of how mant times I have popped the same posting again and again. TO see how dump I am.
print "Program Begins..."
currentPostingDict = {}
inputFileName = "/data3/obukai/workspace/web-search-engine-wei/polyIRIndexer/importantPostingsBeingPoppedAtDifferentLevels"
inputFileHandler = open(inputFileName,"r")
for line in inputFileHandler.readlines():
    lineElements = line.strip().split(" ")
    if len(lineElements) == 0:
        pass
    elif len(lineElements) == 1:
        print line.strip()
    elif len(lineElements) == 2:
        currentTerm = lineElements[0]
        currentDocID = lineElements[1]
        currentPostingKey = currentTerm + "_" + currentDocID
        if currentPostingKey not in currentPostingDict:
            currentPostingDict[currentPostingKey] = 1
        else: 
            currentPostingDict[currentPostingKey] += 1

print "len(currentPostingDict):",len(currentPostingDict)
inputFileHandler.close()
print "Program Ends."


